//
//  ZJBaseVisiorTableViewController.swift
//  Webo
//
//  Created by 曾静 on 16/6/25.
//  Copyright © 2016年 qq. All rights reserved.
//

import UIKit

class ZJBaseVisiorTableViewController: UITableViewController {
    
    let isLogin1:Bool = ZJUserInfoTools.shareUserInfo.isLogin
    
    
    
    var visitorView:ZJVisiorView?
    
    override func loadView() {
        
        //如果登录了
        if isLogin1{
            
            
            
            super.loadView()
            
        }else{
            
            visitorView = ZJVisiorView()
            
            setNav()

            visitorView?.hehe = {[weak self] in
                
            self?.login()
              
            }
            //如果未登录,进入访客视图
            view = visitorView
            
        }
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.backgroundColor = RGB(237, green: 237, blue: 237)
        
        
        
        
        
       
    }
    
    func setNav(){
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "login")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "login")
    }
    
    func login(){
        
        //弹出WebView进行网络的登录
        
        let nav = UINavigationController(rootViewController: ZJOAuthWebViewController())
        
         presentViewController(nav, animated: true, completion: nil)
    }
}

//
//extension ZJBaseVisiorTableViewController :ZJVisiorViewDeleagte{
//    
//    func modalOauthView(){
//        
//        
//        login()
//
//    }
//    
//}